{% extends "base.html" %}
{% block title %}检查单详情{% endblock %}
{% block head %}
    {{ super() }}
    <style>

    </style>
{% endblock %}
{% block body %}
    <div class="contianer info-page" style="display: flex;flex-direction: column;">
        {% if examInfo %}
            {% set exam = examInfo["MedicalRequestInfo"]["RequestInfo"] %}
            <div class="weui-well well-print font14">
                <div class="text-center">
                    <h2>{{ config.HOSPITAL }}
                        <span class="leftRightCicle"></span>
                    </h2>
                </div>
                <div class="weui-flex text-center onlyBottomBorder">
                    <div class="weui-flex__item">
                        <div>{{ examInfo["PatientInfo"]["PatientName"] }} {{ examInfo["PatientInfo"]["PatientAge"] if examInfo["PatientInfo"]["PatientAge"] }}</div>

                        <div class="bcTarget" style="margin:0 auto;height: 5em;" barWidth="2" barHeight="46">
                            <input type="hidden" value="{{ examInfo["PatientInfo"]['PatientID'] }}">
                        </div>
                        <div class="weui-flex font12 text-disabled">
                            <div class="weui-flex__item">
                                <div> 出生日期：{{ examInfo["PatientInfo"]["PatientBirth"]|formatDate }}</div>
                                {#                                <div>{{ exam["DepartMent"] }}</div>#}

                                {#                            <div class="weui-flex">#}
                                {#                                <div class="weui-flex__item">当前状态：#}
                                {#                                    {% if exam["ExamList"]["Exam"]["ExamState"]=='1' %}未报到#}
                                {#                                    {% elif exam["ExamList"]["Exam"]["ExamState"]=='2' %}已报到#}
                                {#                                    {% elif exam["ExamList"]["Exam"]["ExamState"]=='3' %}已检查#}
                                {#                                    {% elif exam["ExamList"]["Exam"]["ExamState"]=='4' %}报告发布#}
                                {#                                    {% elif exam["ExamList"]["Exam"]["ExamState"]=='5' %}退检#}
                                {#                                    {% else %}未知#}
                                {#                                    {% endif %}#}
                                {#                                </div>#}
                                {#                            </div>#}
                            </div>
                            <div class="weui-flex__item">
                                {#                                <div>#}
                                {#                                    <span>队列：</span>#}
                                {#                                    <span>{{ QueueName if QueueName else "无" }}</span>#}
                                {#                                </div>#}
                                <div>
                                    <span>排队号：</span>
                                    <span class="text-red">{{ exam["ReservationInfo"]["QueueNum"] if exam["ReservationInfo"]["QueueNum"] else "无" }}</span>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
                <div class="onlyBottomBorder" style="margin: 10px;">
                    <div class="font12 text-disabled">
                        <span>检查部位：</span>
                        <span>{{ exam["ExamList"]["Exam"]["ExamBodyPart"]|ifNoneParseNullString }}</span>
                    </div>
                    <div class="font12 text-disabled">
                        <span>检查方式：</span>
                        <span>{{ exam["ExamList"]["Exam"]["ExamMethod"]|ifNoneParseNullString }}</span>
                    </div>
                    <div class="font12 text-disabled">
                        <span>检查准备：</span>
                        <span>{{ exam["ExamReady"]|ifNoneParseNullString }}</span>
                    </div>

                    <div class="font12 text-disabled">
                        <span>检查地址：</span>
                        <span>{{ exam["ExamPlace"]|ifNoneParseNullString }}</span>
                    </div>
                    <div class="font12 text-disabled">
                        <span>检查诊室：</span>
                        <span>{{ exam["ExamKSMC"]|ifNoneParseNullString }}</span>
                    </div>
                </div>
                <div class="font12 onlyBottomBorder">
                    <div class="weui-flex text-disabled">
                        <div class="weui-flex__item">检查项目</div>
                        <div style="min-width: 3em;">数量</div>
                        <div style="min-width: 3em;text-align: right">费用</div>
                    </div>
                    {% set FeeList=[] %}
                    {% if exam["FeeList"]["Fee"]|isDict %}
                        {% set FeeList=exam["FeeList"]["Fee"]|parseArray %}
                    {% else %}
                        {% set FeeList=exam["FeeList"]["Fee"] %}
                    {% endif %}
                    {% for fee in FeeList %}
                        <div class="weui-flex">
                            <div class="weui-flex__item">{{ fee["FEENAME"]|ifNoneParseNullString }}</div>
                            <div style="min-width: 3em;">{{ fee["FEENum"]|ifNoneParseNullString +fee["FeeUnit"]|ifNoneParseNullString }}</div>
                            <div style="min-width: 3em;text-align: right">{{ fee["FeePrice"]|ifNoneParseNullString }}元</div>
                        </div>
                    {% endfor %}
                </div>
                <span class="seal">
                {% if exam["FeeState"]=='0' %}未收费
                {% elif exam["FeeState"]=='1' %}已收费
                {% else %}未知
                {% endif %}
            </span>
                <div class="text-disabled">
                    <small>
                        温馨提醒:<br>
                        1.请带病历本到相关科室报到或手机自助报到。
                        <br>2.诊间预约号不予退号。
                        <br>3.公医定点病人请凭此单到门诊收费处办理诊查费按门诊比例记账/缴费。
                    </small>
                </div>
                {#                    <div class="text-center">#}
                {#                        <i class="iconfont">&#xe615;</i>#}
                {#                        报到#}
                {#                    </div>#}


            </div>
        {% else %}
            <div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">无数据返回</span></div>
        {% endif %}
    </div>
{% endblock %}
{% block script %}
    {{ super() }}
    <script src="{{ url_for('page.send_static',filename='js/jquery-barcode.min.js') }}"></script>
    <script type="text/javascript">
        $(".bcTarget").each(function (i, targetQRDiv) {
            var $targetQRDiv = $(targetQRDiv);
            if ($targetQRDiv && $targetQRDiv.children("input").val()) {
                targetStr = $targetQRDiv.children("input").val();
                targetWidth = $targetQRDiv.attr("barWidth");
                if (!targetWidth) {
                    targetWidth = 1;
                }
                targetHeight = $targetQRDiv.attr("barHeight");
                if (!targetHeight) {
                    targetHeight = 23;
                }
                targetType = $targetQRDiv.attr("datatype");
                if (targetType == "qrcode") {
                    $targetQRDiv.qrcode({render: "canvas", width: 100, height: 100, text: targetStr});
                    $targetQRDiv.children("canvas").css('width', 100).css('height', 100);
                    $targetQRDiv.addClass("text-center");
                } else {
                    var encode = "code128";
                    //if (8 === targetStr.length) encode = "ean8";
                    //else if (13 === targetStr.length) encode = "ean13";
                    $targetQRDiv.barcode(targetStr, encode, {
                        barWidth: targetWidth,
                        barHeight: targetHeight,
                        showHRI: true,
                        bgColor: "#fff"
                    });
                }
            }
        })
    </script>
{% endblock %}